package cn.xxm.mq;

import cn.xxm.service.impl.SearchServiceImpl;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class listen {
    @Autowired
    private SearchServiceImpl service;
    @RabbitListener(bindings = @QueueBinding(
            value = @Queue(name = "uptopoc.queue"),
            exchange = @Exchange(name = "ittopic",type = ExchangeTypes.TOPIC),
            key = "items.up"

    ))
    public void upstatus(Long id){
        service.getUpId(id);
    }

    @RabbitListener(bindings = @QueueBinding(
            value = @Queue(name = "downtopoc.queue"),
            exchange = @Exchange(name = "ittopic",type = ExchangeTypes.TOPIC),
            key = "items.down"
    ))
    public void downstatus(Long id){
        service.getdownId(id);
    }

}